import 'package:flutter/material.dart';

class GlobalThemeData {
  // ColorScheme 基于 Material 规范的一组 30 种颜色
  // focusColor 该颜色用于 TextFields 和 TextFormField 邓 Widget，以指示该 widget 是否有主焦点
  static ThemeData themeData(ColorScheme colorScheme, Color focusColor) {
    return ThemeData(
      colorScheme: colorScheme,
      // 这是整个屏幕或应用程序窗口的背景色，它定义了所有其他 UI 元素的基色
      canvasColor: colorScheme.surface,
      // 这具体定义了脚手架本身的背景颜色，包括应用栏、正文内容区域和底部导航栏（如果存在）
      scaffoldBackgroundColor: colorScheme.surface,
      // 该属性定义了用户点击并按住 Widget 时短暂显示的颜色。它为用户提供了交互已注册的视觉反馈
      highlightColor: Colors.transparent,
      // 该属性定义了用于直观显示当前哪个元素具有焦点的颜色，这意味着该元素将接收键盘输入。这对于突出显示当前活动元素，吸引用户注意非常有用
      focusColor: focusColor,
    );
  }

  static final Color _lightFocusColor = Colors.black.withOpacity(0.12);
  static final Color _darkFocusColor = Colors.white.withOpacity(0.12);

  static const ColorScheme lightColorScheme = ColorScheme(
      primary: Color(0xFFB93C5D),
      secondary: Color(0xFFEFF3F3),
      surface: Color(0xFFFAFBFB),
      error: Colors.redAccent,
      onPrimary: Colors.black,
      onSecondary: Color(0xFF322942),
      onSurface: Color(0xFF241E30),
      onError: Colors.white,
      brightness: Brightness.light,
  );

  static const ColorScheme darkColorScheme = ColorScheme(
      primary: Color(0xFFFF8383),
      secondary: Color(0xFF4D1F7C),
      surface: Color(0xFF1F1929),
      error: Colors.redAccent,
      onPrimary: Colors.white,
      onSecondary: Colors.white,
      onSurface: Colors.white,
      onError: Colors.white,
      brightness: Brightness.dark,
  );

  static ThemeData lightThemeData = themeData(lightColorScheme, _lightFocusColor);
  static ThemeData darkThemeData = themeData(darkColorScheme, _darkFocusColor);
  
}